package com.java01.regex.pattern;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *  Compiled pattern
 *  Compiles the given regular expression into a pattern. 
 */
public class Pattern1 {

	public static void main(String[] args) {
		String line = "Welcome to www.java01.com";
		
		Pattern pattern = Pattern.compile("^Welcome.*");
		Matcher matcher =pattern.matcher(line);
		if(matcher.matches()){
			System.out.println("O");
		}else{
			System.out.println("X");
		}
		
		if(line.matches(".*java01.*")){
			System.out.println("O");
		}else{
			System.out.println("X");
		}
	}
}
